package spring.superrun.record.mvc.entity;

import spring.superrun.record.mvc.dto.LocationAddDto;
import spring.superrun.record.mvc.dto.LocationUpdateDto;

import java.io.Serializable;
import java.util.Date;

import static spring.superrun.tool.newid.NewIdByUUId.GetUUIDNoMinus;

/**
 * (SuperrunLocations)实体类
 *
 * @author makejava
 * @since 2021-06-16 16:05:04
 */
public class SuperrunLocations implements Serializable {
    /**
     * 更新的赋值方法
     * @param dto
     * @return
     */
    public SuperrunLocations Update(LocationUpdateDto dto){
        setLocationname(dto.getLocationname());
        setBuilding(dto.getBuilding());
        setLastdistance(dto.getLastdistance());
        setOrderid(dto.getOrderid());
        return this;
    }

    /**
     * 添加的赋值方法
     * @param dto
     * @return
     */
    public SuperrunLocations Add(LocationAddDto dto){
        setId("L"+ GetUUIDNoMinus());
        setLocationname(dto.getLocationname());
        setBuilding(dto.getBuilding());
        setLastdistance(dto.getLastdistance());
        setOrderid(dto.getOrderid());
        setCreatetime(new Date());
        return this;
    }
    private static final long serialVersionUID = 191930737659210969L;
    /**
     * id
     */
    private String id;
    /**
     * 地点详细名称
     */
    private String locationname;
    /**
     * 楼宇名称
     */
    private String building;
    /**
     * 排序id
     */
    private Integer orderid;
    /**
     * 创建时间
     */
    private Date createtime;
    /**
     * 距离上一个点位的距离
     */
    private Double lastdistance;

    private SuperrunLocations Location;

    private SuperrunUserinfos user;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getLocationname() {
        return locationname;
    }

    public void setLocationname(String locationname) {
        this.locationname = locationname;
    }

    public String getBuilding() {
        return building;
    }

    public void setBuilding(String building) {
        this.building = building;
    }

    public Integer getOrderid() {
        return orderid;
    }

    public void setOrderid(Integer orderid) {
        this.orderid = orderid;
    }

    public Date getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }

    public Double getLastdistance() {
        return lastdistance;
    }

    public void setLastdistance(Double lastdistance) {
        this.lastdistance = lastdistance;
    }

    public SuperrunLocations getLocation() {
        return Location;
    }

    public void setLocation(SuperrunLocations location) {
        Location = location;
    }

    public SuperrunUserinfos getUser() {
        return user;
    }

    public void setUser(SuperrunUserinfos user) {
        this.user = user;
    }
}
